package com.jiangtai.smartbox.dialog

import android.content.Context
import android.view.View
import com.flyco.dialog.widget.base.BaseDialog
import com.jiangtai.smartbox.R
import kotlinx.android.synthetic.main.dialog_confirm.*

/**
 * Created by hecuncun on 2021/7/8
 */
class ConfirmDialog(context: Context,var content:String):BaseDialog<ConfirmDialog>(context) {
    override fun setUiBeforShow() {
      widthScale(0.8f)
        tv_title.text = content
        tv_cancel.setOnClickListener {
            onConfirmListener?.onConfirm(false)
        }

        tv_confirm.setOnClickListener {
            onConfirmListener?.onConfirm(true)
        }
    }

    override fun onCreateView(): View {
       return View.inflate(context, R.layout.dialog_confirm,null)
    }

    private var onConfirmListener:OnConfirmListener ?= null

    interface OnConfirmListener{
        fun onConfirm(sure:Boolean)
    }

    fun setonConfirmListener(onClickListener:OnConfirmListener){
        onConfirmListener = onClickListener
    }
}